import { RootStateITF } from '@REDUXITF/index'
import { useSelector } from 'react-redux'

export type RootSelector<TSelected> = (state: RootStateITF) => TSelected
export type RS<TSelected> = RootSelector<TSelected>

export const useRootSelector = <TSelected>(
  selector: RS<TSelected>
): TSelected => {
  const res = useSelector<RootStateITF, TSelected>(selector)
  return res
}

export const useRS = useRootSelector
